package homework.threadwork.testing;

import homework.threadwork.coding.Cat;
import homework.threadwork.coding.Dog;
import homework.threadwork.coding.Letter;
import homework.threadwork.coding.ThreadDemo;

class MyThread extends Thread{
    private  String name;
    public MyThread(String name){
        this.name=name;
    }
    public static synchronized void  show(){
        try {
            sleep(3000);
            for (int i=0;i<1000;i++){
                System.out.println(currentThread().getName()+":index:"+i);
            }
            System.out.println(currentThread().getName()+":finished~");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    public synchronized void run(){
       show();
    }}
public class Test {
    public static void main(String[] args) {
        Letter letter=new Letter();
        Thread thread=new Thread(letter);
        thread.start();
    }
}
